package selenium.lessons.pages;

import com.sun.corba.se.impl.logging.ORBUtilSystemException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 23.03.13
 * Time: 7:16
 * To change this template use File | Settings | File Templates.
 */
public class LoginPage extends Page{

    public LoginPage(WebDriver webDriver) {
        super(webDriver);
    }

    public WebDriver Login(String loginPageUrl)
    {
        try
        {
            webDriver.get(loginPageUrl);
            webDriver.findElement(By.id("username")).clear();
            webDriver.findElement(By.id("username")).sendKeys("admin");
            webDriver.findElement(By.name("password")).clear();
            webDriver.findElement(By.name("password")).sendKeys("admin");
            webDriver.findElement(By.name("submit")).click();
        }
        catch (Exception e){
        }
        return webDriver;
    }
}
